package cloud.estate.house.controller;

import cloud.estate.commons.bean.House;
import cloud.estate.commons.util.JsonResult;
import cloud.estate.house.service.houseService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/house")
public class houseController {
    @Resource
    private houseService houseService;

    @PostMapping("/addOneHouse")
    public JsonResult addOneHouse(House house) {
        return houseService.addOneHouse(house);
    }

    @PostMapping("/deleteOneHouse")
    public JsonResult deleteOneHouse(String id) {
        return houseService.deleteOneHouse(id);
    }

    @PostMapping("/updateOneHouse")
    public JsonResult updateOneHouse(House house) {
        return houseService.updateOneHouse(house);
    }

    @GetMapping("/getOneHouse")
    public JsonResult getOneHouse(String id) {
        return houseService.getOneHouse(id);
    }
    @GetMapping("/listAllHouse")
    public JsonResult listAllHouse() {
        return houseService.listAllHouse();
    }

}
